import _ from 'lodash';
import loginStore from '@/store/loginStore';
export function fetchJson(that, url, data) {
    return new Promise(function(solve, reject) {
        let token = localStorage.getItem('token');
        if (!_.isEmpty(token)) {
            data.token = token;
        } else {
            data.token = "";
        }
        console.log('发送请求:' + url + '\n' + 'data:' + JSON.stringify(data));
        that.$http.post(url, data).then(res => {
            console.log('接收数据:' + url + '\n' + JSON.stringify(res.data));
            solve(res.data);
        }).catch(function(err) {
            reject(err);
            console.log(err);
        });
    })
}
export default fetchJson;


// WEBPACK FOOTER //
// ./src/common/js/request.js